package tree_util;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import db_tool.DbBean;
import org.apache.struts2.ServletActionContext;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class Login extends ActionSupport {

	private String username;
	private String password;
	
	@Override
	public String execute() {
		ServletActionContext.getResponse().setContentType("text/html;charset=utf-8");
		List<String> monName = new ArrayList<String>();
		DbBean db = new DbBean();
	 	try {
	 		monName = db.queryMoniter();
	 		Map<String,Object> map = ActionContext.getContext().getSession();
	 		map.put("moniter",monName);
	 		
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return SUCCESS;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
}
